/**
 *
 *
 * @export
 * @param {*} refValue  传入的ref
 */
export default function (refValue) {
    return {
        mounted() {
            this.$refs[refValue].addEventListener("scroll", this.listScroll);
            this.$bus.$on("scrollTop", this.scrollTop);
        },
        beforeDestroy() {
            this.$bus.$emit("mainScroll");
            this.$refs[refValue].removeEventListener("scroll", this.listScroll);
            this.$bus.$off("scrollTop", this.scrollTop);
        },
        methods: {
            scrollTop(scrollTop) {
                this.$refs[refValue].scrollTop = top;
            },
            listScroll() {
                this.$bus.$emit("mainScroll", this.$refs[refValue]);
            }
        }
    }
}